import ChannelIndex from '@/components/view/channel/ChannelIndex.vue'
import ChannelList from '@/components/view/channel/ChannelList.vue'
import ChannelPost from '@/components/view/channel/ChannelPost.vue'
import ADList from '@/components/view/channel/ADList.vue'
import ADPost from '@/components/view/channel/ADPost.vue'

import fileinputServer from '@/components/server/fileinput.js'


// import '../../../static/js/inspinia.js'

// import '../../../static/js/plugins/metisMenu/jquery.metisMenu.js'    
// import '../../../static/js/plugins/slimscroll/jquery.slimscroll.min.js'

// 懒加载的实现
const FooChannelIndex = r => require.ensure([], () => r(ChannelIndex), 'group-foo')
const FooChannelList = r => require.ensure([], () => r(ChannelList), 'group-foo')

export default {
  path: '/:username/Channel',
  name: 'Channel',
  component: FooChannelIndex,
  // 重定向到渠道列表
  redirect: { name: 'ChannelList' },
  children: [
    {
      // 渠道列表
      path: 'List',
      name: 'ChannelList',
      components: {
        default: FooChannelList
      }
    },
    {
      // 渠道提交表单页面
      path: 'Post',
      name: 'ChannelPost',
      components: {
        default: ChannelPost
      }
    },
    {
      // 广告列表
      path: ':channelid/AD/List',
      alias: ':channelid/ADList',
      name: 'ADList',
      components: {
        default: ADList
      }
    },
    {
      // 广告提交页面
      path: ':channelid/AD/Post',
      alias: ':channelid/ADPost',
      name: 'ADPost',
      components: {
        default: ADPost
      },
      beforeEnter: (to, from, next) => {
        // console.log("beforeEnter");
        // fileinputServer.asdad()
        next();
      }

    }
  ],
  beforeEnter: (to, from, next) => {
    // fileinputServer.asdad()
    next();
  }

}
